<template>
  <div class="header">
    <div class="header-left" @click="logout">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input" @click="goSearch">
      <span class="iconfont">&#xe632;</span>
      输入员工姓名/工号/部门
    </div>
    <router-link to="/empadd">
      <div class="header-right">
        添加
        <span class="iconfont arrow-icon">+</span>
      </div>
    </router-link>
  </div>
</template>

<script>
  export default {
    name: "mainHeader",
    methods: {
      goSearch () {
        this.$router.push('/search')
      },
      logout() {
        if (confirm('退出登录？')){
          this.$router.push('/login')
          localStorage.clear()
        }
      }
    }
  }
</script>

<style lang="stylus" scoped>
  @import "~styles/varibles.styl"
  .header
    display flex
    line-height $headerHeight
    background $bgColor
    color #ffffff
    .header-left
      width .64rem
      float left
      .back-icon
        text-align center
        font-size .4rem
    .header-input
      flex 1
      height .64rem
      line-height .64rem
      margin-left .2rem
      margin-top .12rem
      padding-left .2rem
      background #ffffff
      border-radius .1rem
      color #ccc
    .header-right
      min-width 1.04rem
      padding 0.1rem
      float right
      text-align center
      color: #ffffff
      .arrow-icon
        font-size .24rem
</style>
